package com.prs.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

    private static SimpleDateFormat sdfddMMyyyy = new SimpleDateFormat("yyyy-MM-dd");

    public static String getTodayAsString() {
        return new SimpleDateFormat("dd/MM/yyyy").format(Calendar.getInstance().getTime());
    }

    public static String getTodayAsStringYMD() {
        return new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
    }
    public static Date getTodayAsStringYMD2() {
        return Calendar.getInstance().getTime();
    }
    public static int getCurrentYear() {
        return Calendar.getInstance().get(Calendar.YEAR);
    }
    public static String formatDateAsDMY(String date){
        Date realDate=null;
        try {
            realDate=new SimpleDateFormat("yyyy-MM-dd").parse(date);
            
        } catch (ParseException ex) {
           throw new PrsException(ex);
        }
        return new SimpleDateFormat("dd/MM/yyyy").format(realDate);
    }
    public static void main(String args[]) {
        System.out.println(DateUtil.getCurrentYear());
    }
}
